fix(validate-env): add IRSA and EKS Pod Identity support for Bedrock …#1038
Open
alexwang2013 wants to merge 1 commit intoanthropics:mainfrom
Open
fix(validate-env): add IRSA and EKS Pod Identity support for Bedrock …#1038alexwang2013 wants to merge 1 commit intoanthropics:mainfrom
alexwang2013 wants to merge 1 commit intoanthropics:mainfrom
Conversation
…auth Previously, the Bedrock credential validation only accepted static IAM user keys (AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY) or a bearer token (AWS_BEARER_TOKEN_BEDROCK), which forced users to create long-lived IAM user credentials — a security anti-pattern in containerized environments. This commit adds support for two additional AWS credential mechanisms that are natively supported by the AWS SDK credential provider chain: - IRSA (IAM Roles for Service Accounts): requires both AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN to be set together - EKS Pod Identity: requires both AWS_CONTAINER_CREDENTIALS_FULL_URI and AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE to be set together Partial configuration of either mechanism (only one of a required pair) now produces a specific, actionable error message rather than falling through to a generic 'no credentials found' failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a security gap in
validate-env.tswhere Bedrock authentication only accepted static long-lived IAM user credentials, making it incompatible with recommended AWS security practices for containerized workloads (EKS, GitHub Actions OIDC, etc.).Problem
The existing validation required either:
AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEY(long-lived IAM user keys), orAWS_BEARER_TOKEN_BEDROCK(static bearer token)This forced users running Claude Code in EKS or GitHub Actions to create IAM users with long-lived credentials — which violates AWS best practices and introduces unnecessary security risk (credential leakage, no automatic rotation, no expiry).
The AWS SDK already supports temporary credentials via its credential provider chain, but the hard validation failure prevented it from ever being reached.
Changes
AWS_WEB_IDENTITY_TOKEN_FILE+AWS_ROLE_ARNAWS_CONTAINER_CREDENTIALS_FULL_URI+AWS_CONTAINER_AUTHORIZATION_TOKEN_FILESecurity Impact
Users can now authenticate using short-lived, automatically rotated credentials via IAM Roles — no IAM users or long-lived keys required. This aligns with AWS security best practices for containerized workloads.
Supported Auth Methods (after this PR)
AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEYAWS_BEARER_TOKEN_BEDROCKAWS_WEB_IDENTITY_TOKEN_FILE+AWS_ROLE_ARNAWS_CONTAINER_CREDENTIALS_FULL_URI+AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE